import java.util.Scanner;
import java.io.Console;

public class CardTest {
    public static void main(String[] args) {
        Card zs = new Card(1011111,0,0, "ax", "user10124"); //模拟银行卡开业务
        Scanner reader = new Scanner(System.in);
        Console console = System.console();
        int n;
        double money;
        String pwd;
        String pwd1;

        System.out.println("您好，欢迎您来打我们银行办卡，请输入一下信息，谢谢配合：");
        System.out.print("请输入您的姓名：");
        zs.username = reader.next();
        System.out.print("请输入您的密码：");
        zs.password = reader.next();
        System.out.print("请输入您的身份证：");
        zs.uid = reader.next();
        System.out.println("感谢您的配合，下面是您银行卡的信息：");
        zs.Massage();

        while(true){
            //菜单
            System.out.println();
            System.out.println();
            System.out.println("--------------------------------------");
            System.out.println("-------------   菜  单   --------------");
            System.out.println("-----1.查看卡内信息------2.存款-----------");
            System.out.println("-----3.取款-------------4.修改密码-------");
            System.out.println("-----0.退出-----------------------------");
            System.out.print("---------------  请输入操作：>  ");
            n = reader.nextInt();
            System.out.println();
            System.out.println();


            switch (n){
                case 1:
                    zs.Massage();
                    break;
                case 2:
                    System.out.print("请输入存款金额：");
                    money=reader.nextDouble();
                    zs.deposh(money);
                    System.out.println("存款成功，卡内与余额为："+zs.getBalance());
                    break;
                case 3:
                    System.out.println("请输入取款金额：");
                    money=reader.nextDouble();
                    zs.drawMoney(money);
                    System.out.println("取款成功，卡内与余额为："+zs.getBalance());
                    break;
                case 4:
                    System.out.print("请输入原来的密码：");
                    pwd=reader.next();
                    if(pwd == zs.password){
                        System.out.println("输入正确 ：）");
                        System.out.print("请输入修改后的密码：");
                        pwd = reader.next();
                        System.out.print("请再次输入修改后的密码：");
                        pwd1 = reader.next();
                        if(pwd == pwd1){
                            System.out.println("密码已修改完成");
                            zs.password = pwd;
                        }else{
                            System.out.println("两次密码不符合，请重新输出一遍");
                        }
                    }else{
                        System.out.println("no");
                    }

                    break;
                case 0:
                    System.exit(0);
                default:
                    System.out.println("输入错误！");


            }
        }
    }
}
